/*************************************************************************
    > File Name: 14.c
    > Author: ant
    > Created Time: 2021/2/22 16:54:12
 ************************************************************************/

#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
map<long long,int> dp;

const int maxn = 1000001;
int dfs(long long n){
	if(dp[n])return dp[n];
	if(n==1)return 0;
	if(n&1)dp[n]=1+dfs(3*n+1);
	else dp[n] =1+dfs(n/2);
}
int main()
{
	int ans =0;
	int mx =0;
	for(long long i=2;i<maxn;++i){
		int cnt = dfs(i);
		if(mx<cnt){
			mx=cnt;
			ans=i;
		}
	}
	cout<<ans<<endl;
    return 0;
}

